from fudge.core import *
from fudge.resources import Texture

class DefaultRenderer(object):
    ''' Default Renderer '''
    def Initialize(self):
        glClearColor(0.0, 0.0, 0.0, 1.0)					# This Will Clear The Background Color To Black
        glClearDepth(1.0)									# Enables Clearing Of The Depth Buffer
        glDepthFunc(GL_LEQUAL)								# The Type Of Depth Test To Do
        glEnable(GL_DEPTH_TEST)								# Enables Depth Testing
        glShadeModel (GL_SMOOTH)
        glHint (GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) 	# Really Nice Perspective Calculations
        
        # gluQuadricTexture(g_quadratic, GL_TRUE);			# // Create Texture Coords

        glEnable (GL_LIGHT0)
        glEnable (GL_LIGHTING)
        glEnable (GL_COLOR_MATERIAL)
                
    def Render(self, e):
        
        
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)				# // Clear Screen And Depth Buffer
        glLoadIdentity()
        glPushMatrix()
        
        e.scene._draw()

        glFlush ()														# // Flush The GL Rendering Pipeline
        glutSwapBuffers()
        glPopMatrix()
        glDisable(GL_TEXTURE_2D)